package cn.usian.product.config;

import cn.usian.jyzx.model.vo.common.Result;
import cn.usian.jyzx.model.vo.common.ResultCodeEnum;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Component
public class MyException {

    @ExceptionHandler(Exception.class)
    public Result<String> doException(Exception e){
        // 当程序出现异常之后,一定是先记录,再展示
        e.printStackTrace();
        return Result.build("亲,服务器正在升级,请稍后重试...", ResultCodeEnum.SYSTEM_ERROR);
    }

}
